package klasy.powtorka;

import java.text.DateFormat;
import java.util.Date;

public final class ImmutablePerson {

	private String lastName;
	private String firstName;
	private Date dob;
	
	public ImmutablePerson(String lastName, String firstName, Date dob){
		this.lastName = lastName;
		this.firstName = firstName;
		this.dob = dob;
//		this.dob = new Date(dob.getTime());
	}

	public String getLastName() {
		return lastName;
	}

	public String getFirstName() {
		return firstName;
	}

	public Date getDob() {
		return dob;
//		return (Date) dob.clone();
	}
	
	@Override
	public String toString(){
		return firstName + " " + lastName + ", urodzony: " + DateFormat.getDateInstance().format(dob);
	}
	
}
